<%--
  Created by IntelliJ IDEA.
  User: Jun
  Date: 2018/8/20
  Time: 9:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="pu" uri="http://pageUtil.cn/common/" %>
<%@ page trimDirectiveWhitespaces="true" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <!-- Bootstrap Core CSS -->
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="${pageContext.request.contextPath}/css/metisMenu.min.css" rel="stylesheet">

    <!-- DataTables CSS -->
    <link href="${pageContext.request.contextPath}/css/dataTables.bootstrap.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="${pageContext.request.contextPath}/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="${pageContext.request.contextPath}/css/font-awesome.min.css" rel="stylesheet"
          type="text/css">
    <link href="${pageContext.request.contextPath}/css/boot-crm.css" rel="stylesheet"
          type="text/css">

    <!--<script-->
    <script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <script type="text/javascript">
        window.onload = function () {
            // alert("1");
            var height = $(window).height();
            $("#wrapper").css("height", height);
        }
    </script>
</head>
<body>
<div id="wrapper" style="background-color:#000000;">
    <!-- Navigation -->
    <nav class="navbar navbar-default navbar-static-top" role="navigation"
         style="margin-bottom: 0;background-color: #01C9E2">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse"
                    data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span> <span
                    class="icon-bar"></span> <span class="icon-bar"></span> <span
                    class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">IRIM后端控制管理系统</a>
        </div>

        <ul class="nav navbar-top-links navbar-right">
            <div class=" logincss">登录界面</div>
        </ul>

    </nav>

    <div class="panel panel-default page-wapper loginstyle">

        <div class=" text-center text-info">
            <h2>请登录</h2>
        </div>
        <div class="form row">
            <div class="form-horizontal col-md-offset-3" id="login_form">

                <div class="col-md-9">
                    <div class="formstyle">
                        <i class="fa fa-user fa-lg"></i>
                        <input class="form-control required" type="text" placeholder="Username" id="username" name="username" autofocus="autofocus" maxlength="10"/>
                    </div>
                    <div class="formstyle">
                        <i class="fa fa-lock fa-lg"></i>
                        <input class="form-control required" type="password" placeholder="Password" id="password" name="password" maxlength="8"/>
                    </div>
                    <!--<div class="form-group">-->
                    <!--<label class="checkbox">-->
                    <!--<input type="checkbox" name="remember" value="1"/>记住我-->
                    <!--</label>-->
                    <!--</div>-->
                    <div class="formstyle col-md-offset-9">
                        <button class="btn btn-success pull-right" id="userlogin">登录</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>




<!-- jQuery -->
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>

<!-- Metis Menu Plugin JavaScript -->
<script src="${pageContext.request.contextPath}/js/metisMenu.min.js"></script>

<!-- DataTables JavaScript -    ->
<script src="../js/jquery.dataTables.min.js"></script>
<script src="../js/dataTables.bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="${pageContext.request.contextPath}/js/sb-admin-2.js"></script>

<script type="text/javascript">
    $("#userlogin").click(function () {
        var username=$("#username").val();
        var password=$("#password").val();
        $.ajax({
            type:"POST",
            url:"login.action",
            data:{
                "username":username,
                "password":password
            },
            dataType:"json",
            async:true,
            success:function (data) {
                if(data.code==1001){
                    alert(data.msg);
                    window.location.href="dev/list";
                }if(data.code==1002){
                    alert(data.msg);
                }if(data.code=1003){
                    alert(data.msg);
                }
            },
            error:function (data) {
                alert("服务器出错");
            }
        })
    });

</script>

</body>

</html>